//package org.karelun.rabbit.rcp.command;
//
//import org.eclipse.gef.commands.Command;
//import org.karelun.rabbit.graph.Connection;
//import org.karelun.rabbit.graph.Diagram;
//import org.karelun.rabbit.graph.Shape;
//
//public class CreateConnectionCommand extends Command {
//	
//	private Connection connection;
//	
//	private Shape sourceShape;
//	
//	private Shape targetShape;
//	
//	public CreateConnectionCommand(Connection newObject) {
//		this.connection=newObject;
//	}
//
//	public void setSource(Shape shape) {
//		this.sourceShape=shape;
//		
//	}
//
//	public void setTarget(Shape shape) {
//		this.targetShape=shape;
//	}
//	
//	@Override
//	public void execute() {
//		connection.setSourceShape(sourceShape);
//		connection.setTargetShape(targetShape);
//		
//		Diagram diagram=(Diagram)sourceShape.eContainer();
//		diagram.getConnections().add(connection);
//	}
//	
//	@Override
//	public void undo() {
//		connection.setSourceShape(null);
//		connection.setTargetShape(null);
//		
//		sourceShape.getSourceConnections().remove(connection);
//		sourceShape.getTargetConnections().remove(connection);
//		
//		Diagram diagram=(Diagram)sourceShape.eContainer();
//		diagram.getConnections().remove(connection);
//	}
//
//}
